Unity 2018 Augmented Reality Projects by Jesse Glover

Unity 2018 Augmented Reality Projects by Jesse Glover

Author:Jesse Glover
Language: eng
Format: epub
Tags: COM057000 - COMPUTERS / Virtual Worlds, COM012040 - COMPUTERS / Programming / Games, COM051310 - COMPUTERS / Programming Languages / C#
Publisher: Packt Publishing
Published: 2018-07-30T06:54:06+00:00


For Unity specifically, plugins allow us to directly interface with native calls and use them as we wish in our application or games. Many developers tend to create plugins with native system calls to extend the render pipeline or for enhancing shaders.

It is important to note that there are two very distinct plugin types available to use in Unity. Those two types are Native Plugins and Managed Plugins. A very simplified explanation of the difference between native and managed plugins is that native plugins are for low-level calls, and managed plugins are an easy way to hide source code.

There is, however, a more nuanced differentiation between them than this old adage.

A managed plugin can and will easily hide source code from prying eyes when a developer wants to sell something in the asset store. It can also be used to include libraries and frameworks that are not otherwise readily available to Unity. For example, a developer could import the Entity Framework dll files into Unity and utilize the Entity Framework to create, manage, and handle database code with Unity. The final thing that a managed plugin can do is allow a developer to utilize some .NET languages and compilers that are not supported by Unity, such as F#, JScript, IronPython, ClosureCLR, or even Powershell. For example, a developer could create a plugin for Unity that allows for scripting in IronPython, or they could write game code using IronPython and import it as a plugin and use it without issues.

A native plugin, on the other hand, is profoundly more powerful. A native plugin normally consists of using Java, Swift, Objective-C, or C++ to access the direct hardware of their respective devices and provide functionality that a developer could otherwise not have access to within Unity. Let’s say a developer is working with a device that connects to a smartphone that is not normally present in smartphones; in this case, we will go with the BACtrack Mobile Pro as our example.

The BACtrack Mobile pro is a police-grade breathalyzer that can check a user’s blood alcohol content and send that information to a device via Bluetooth connections. This developer wants to make a drinking-style AR game, and they want to make the game harder, the higher the end user’s BAC level is. This developer would need to use a native plugin to gain access to the BACtrack device’s sensors' results.

Now that a firm understanding should have been gained from this explanation, we can finally start looking at the structure of a plugin for C++, Swift, C#, and Java. What we will do is create a very simple plugin that will simply add two numbers together. This is to keep things simple and allow for the flow of steps for the overall workflow to be much more easy to follow.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.